package edu.pku.sei.act.codegen.getinfor;

import edu.pku.sei.act.model.mote.DataItem;
import edu.pku.sei.act.mote.myenum.TypeEnum;
import edu.pku.sei.act.mote.myenum.VisibilityEnum;
import edu.pku.sei.act.mote.myenum.YNEnum;

public class DataItemForCode {

	private String variable = "";
	private VisibilityEnum visibility;
	private TypeEnum type ;
	private YNEnum isStatic,isFinal,hasInitialValue;
	private String varValue = "";
	
	public DataItemForCode(DataItem data){
		this.variable = data.getVariable();
		this.visibility = data.getVisibility();
		this.type = data.getType();
		this.isStatic = data.getIsStatic();
		this.isFinal = data.getIsFinal();
		this.hasInitialValue = data.getHasInitialValue();
		this.varValue = data.getVarValue();
		
	}
	
	public String getVariable(){
		return this.variable;
	}
	public String getVarValue(){
		return this.varValue;
	}
	
	public String getVisibility(){
		String v = null ;
		if(this.visibility==VisibilityEnum.Public){
           v = "public";			
		}else if(this.visibility==VisibilityEnum.Private){
			v = "private";
		}else if(this.visibility==VisibilityEnum.Protected){
			v = "protected";
		}else{
			v = "public";
		}
		return v;
	}
	
	public String getType(){
		String t = null;
		if(this.type==TypeEnum.Int){
			t = "int";
		}else if(this.type==TypeEnum.Char){
			t = "char";
		}else if(this.type==TypeEnum.Long){
			t = "long";
		}else if(this.type==TypeEnum.Short){
			t = "short";
		}else if(this.type==TypeEnum.Byte){
			t = "byte";
		}else{
			t = "int";
		}
		return t;
	}
	
	public boolean getIsStatic(){
		boolean t = false;
		if(this.isStatic==YNEnum.Yes){
			t = true;
		}else if(this.isStatic==YNEnum.No){
			t = false;
		}else{
			t = false;
		}
		return t;
	}
	
	public boolean getIsFinal(){
		boolean t = false;
		if(this.isFinal==YNEnum.Yes){
			t = true;
		}else if(this.isFinal==YNEnum.No){
			t = false;
		}else{
			t = false;
		}
		return t;
	}
	
	public boolean getHasInitialValue(){
		boolean t = false;
		if(this.hasInitialValue==YNEnum.Yes){
			t = true;
		}else if(this.hasInitialValue==YNEnum.No){
			t = false;
		}else{
			t = false;
		}
		return t;
	}
	
}
